package www.bw.com.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import www.bw.com.entities.Menu;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController {

  @GetMapping
  public List<Menu> listMenu() {
    //去数据库查询
    List<Menu> menus1 = Arrays.asList(
      new Menu(11, "用户管理", "icon-tuichu"),
      new Menu(12, "角色管理", "icon-tuichu"),
      new Menu(13, "菜单管理", "icon-tuichu"),
      new Menu(14, "按钮管理", "icon-tuichu")
    );

    Menu m1 = new Menu(1, "权限管理", "icon-tuichu", menus1);

    List<Menu> menus2 = Arrays.asList(
      new Menu(21, "系统日志", "icon-tuichu"),
      new Menu(22, "安全退出", "icon-tuichu"),
      new Menu(23, "重置密码", "icon-tuichu")
    );

    Menu m2 = new Menu(2, "系统管理", "icon-tuichu", menus2);

    return Arrays.asList(m1, m2);
  }
}
